import { defineStore } from "pinia";
import { computed, ref } from "vue";

//示例状态存储
export const useExamplesStore = defineStore(
  "simple",
  () => {
    const dataTreeList = ref([]);

    const dataExampleList = ref([]);
    const testData = ref([]);

    const computedDataExampleList = computed(() => {
      return dataExampleList.value;
    });

    function setDataExampleList(list) {
      dataExampleList.value = list;
    }

    function getDataExampleList() {
      return dataExampleList.value;
    }

    function setDataTreeList(list) {
      dataTreeList.value = list;
    }
    function getDataTreeList() {
      return dataTreeList.value;
    }
    return {
      dataTreeList,
      dataExampleList,
      computedDataExampleList,
      setDataTreeList,
      getDataTreeList,
      setDataExampleList,
      getDataExampleList,
    };
  },
  {
    persist: {
      storage: window.sessionStorage,
    },
  }
);
